package com.tsll.controller;

import com.tsll.annotation.MyLog;
import com.tsll.dao.StaffsalMapper;
import com.tsll.entity.Role;
import com.tsll.entity.Staffsal;
import com.tsll.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sal")
public class StaffSalController {
    @Autowired
    private StaffsalMapper staffsalMapper;
    /**
     * 更新员工薪资信息
     */
    @MyLog(businessName = "更新员工薪资信息")
    @RequestMapping("/update/{id}")
    public Result update(@RequestBody Staffsal staffsal,@PathVariable Integer id){
        staffsal.setStaffid(id);
        staffsal.setCount(staffsal.getStaffSal()+staffsal.getStaffComm()+staffsal.getStaffBonus()-staffsal.getStaffDeductmoney());
        int i = staffsalMapper.updateByPrimaryKeySelective(staffsal);
        return new Result(200,"修改成功",i);
    }
}
